﻿<!--
// file:	Editors\TextBlockEditor.xaml
//
// summary:	text block editor class
-->
<UserControl x:Class="XamlHelpmeet.UI.Editors.TextBlockEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Loaded="TextBlockEditor_Loaded">
    <UserControl.Resources>
        <Style TargetType="{x:Type StackPanel}">
            <Setter Property="Margin" Value="0,10,0,0" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal">
            <TextBlock Width="50" Text="Path" />
            <Grid>
                <TextBox x:Name="txtBindingPath"
                         Width="100"
                         VerticalAlignment="Top" />
                <ComboBox x:Name="cboBindingPath"
                          MinWidth="100"
                          VerticalAlignment="Top"
                          SelectedValuePath="Name"
                          Visibility="Collapsed">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=Name}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </Grid>
        </StackPanel>

        <StackPanel Grid.Row="1" Orientation="Horizontal">

            <TextBlock Margin="0,0,4,0"
                       HorizontalAlignment="Left"
                       Text="Format" />
            <Grid>
                <ComboBox x:Name="cboStringFormat"
                          Height="{Binding ActualHeight,
                                           ElementName=txtStringFormat,
                                           Mode=OneWay}"
                          MaxWidth="117"
                          Focusable="False"
                          SelectedValuePath="StringFormatParsedValue"
                          SelectionChanged="cboStringFormat_SelectionChanged">

                    <ComboBox.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <TextBlock Margin="0,5,0,0"
                                               Background="AntiqueWhite"
                                               FontWeight="Bold"
                                               Padding="2,0,0,0"
                                               Text="{Binding Path=Name}" />
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                        </GroupStyle>
                    </ComboBox.GroupStyle>
                </ComboBox>

                <TextBox x:Name="txtStringFormat"
                         Width="100"
                         Margin="0,0,17,0"
                         VerticalAlignment="Top"
                         TextChanged="FormatChanged" />
            </Grid>
        </StackPanel>
    </Grid>
</UserControl>